One or more aspects of the present invention relate to controlling a byte code transformer on detection of completion of an asynchronous command.
Processing of commands can occur synchronously or asynchronously. A synchronous command is considered to have achieved an expected result when the synchronous command finishes and returns to an operating system or some other initiator.
An asynchronous command (e.g., to start an application; to enable a setting; etc.) is a command that may not necessarily have achieved an expected result when control is returned to the operating system. A test framework associated with issuing an asynchronous command is responsible for checking whether the asynchronous command has achieved an expected result. In one example, the test framework invokes a checking routine which checks whether an expected result (e.g., opening of a port; generation of a file; generation of a log entry; etc.) associated with, e.g., whether an application has started, has occurred. The checking routine can set a return code for an outcome of the asynchronous command, wherein the return code is associated with success or failure of an asynchronous command. A command is considered to be asynchronous if an associated checking routine is provided by the test framework.
A system (100) for issuing asynchronous commands as is known in the prior art is shown in FIG. 1. The system (100) comprises an application (110) such as a messaging application, residing on a device (105), such as a server computer, and operable to communicate with a test framework (115). The test framework (115) is operable to issue one or more asynchronous commands to the application (110). In an example, the test framework (115) interacts with the application (110) in order to send the application (110) an asynchronous command e.g., “startapp <app_name>” which is operable to start a messaging application. Following issuing of the asynchronous command, the test framework (115) invokes a checking routine to check whether an expected result (e.g., that a messaging application has started) is achieved. If the expected result is achieved, the test framework (115) can initiate further operations associated with testing of the application (110) (e.g., sending one or more messages to the messaging application; determining whether the one or more messages have been processed successfully and in response to the one or more messages being processed successfully, stopping the messaging application). An example flow of the interactions between the application (110) and the test framework (115) is shown below:                1. Start messaging application        2. Determine whether messaging application has started        3. Send one or more messages to the messaging application        4. Determine whether the one or more messages have been processed successfully        5. Stop the messaging application        
There are a number of problems associated with known test frameworks. For example, a maximum wait time can be set by a user to control how long the operating system should wait before considering the asynchronous command to be in error. However, the maximum wait time associated with a checking routine is configured manually and can be difficult to estimate—if an administrator of the test framework estimates a maximum wait time of sixty seconds yet an expected result is achieved in twenty seconds, the checking routine wastes time while waiting for the remaining forty seconds. The sum of such wastage can become significant in large test suites and impact other running processes. In another example, the test framework can invoke a checking routine which frequently polls the application to determine whether an expected result has occurred. However, the polling frequency is configured manually and can also be difficult to estimate—if an administrator of the test framework estimates a polling frequency of two seconds, yet an expected result is achieved in sixty seconds, the checking routine wastes resources by polling continuously for the preceding fifty eight seconds.